<div class="d-flex justify-content-center">
  <div class="col-8">
    @if (tag()) {
      <div>
        <h2 data-cy="tagDetailsHeading"><span jhiTranslate="blogApp.tag.detail.title">Tag</span></h2>

        <hr />

        <jhi-alert-error></jhi-alert-error>

        <jhi-alert></jhi-alert>

        <dl class="row-md jh-entity-details">
          <dt><span jhiTranslate="global.field.id">ID</span></dt>
          <dd>
            <span>{{ tag()!.id }}</span>
          </dd>
          <dt><span jhiTranslate="blogApp.tag.name">Name</span></dt>
          <dd>
            <span>{{ tag()!.name }}</span>
          </dd>
          <dt><span jhiTranslate="blogApp.tag.post">Post</span></dt>
          <dd>
            @for (post of tag()!.posts; track $index; let last = $last) {
              <span>
                <a [routerLink]="['/post', post.id, 'view']">{{ post?.id }}</a
                >{{ last ? '' : ', ' }}
              </span>
            }
          </dd>
        </dl>

        <button type="submit" (click)="previousState()" class="btn btn-info" data-cy="entityDetailsBackButton">
          <fa-icon icon="arrow-left"></fa-icon>&nbsp;<span jhiTranslate="entity.action.back">Back</span>
        </button>

        <button type="button" [routerLink]="['/tag', tag()!.id, 'edit']" class="btn btn-primary">
          <fa-icon icon="pencil-alt"></fa-icon>&nbsp;<span jhiTranslate="entity.action.edit">Edit</span>
        </button>
      </div>
    }
  </div>
</div>
